/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/idenger">idenger</a> All rights reserved.
 */
package com.idenger.modules.edu.service.course;

import java.util.List;

import com.idenger.common.service.CrudService;
import com.idenger.modules.edu.entity.course.CourseAndProjectDto;
import com.idenger.modules.edu.entity.course.EduCourse;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.idenger.common.persistence.Page;
import com.idenger.modules.edu.dao.course.EduCourseDao;

/**
 * 课程Service
 * @author chenlin
 * @version 2017-11-29
 */
@Service
@Transactional(readOnly = true)
public class EduCourseService extends CrudService<EduCourseDao, EduCourse> {

	public EduCourse get(String id) {
		return super.get(id);
	}
	
	public List<EduCourse> courseListByOrderId(String orderId){
		return dao.courseListByOrderId(orderId);
	}
	

	
	/***
	 * 查询这个项目下买了哪些项目
	 * @param projectId
	 * @return
	 */
	public List<EduCourse> courseListByEnrollProjectId(String projectId,String userId){
		return dao.courseListByEnrollProjectId(projectId,userId);
	}
	
	
	public EduCourse getCourse(String videoId){
		return dao.getCourse(videoId);
	}
	
	public EduCourse getCourse2(String practiceId){
		return dao.getCourse2(practiceId);
	}

	public String getVideoValidScore(String userId,String courseId){

		return dao.getVideoValidScore(userId,courseId);
	}
	
	public String getPracticeValidScore(String userId,String courseId){
		return dao.getPracticeValidScore(userId,courseId);
	}
	
	public List<EduCourse> findList(EduCourse eduCourse) {
		return super.findList(eduCourse);
	}
	public List<EduCourse> getEmptyCourse(String projectId){
		return dao.getEmptyCourse(projectId);
	}

	public List<EduCourse> findProjectContentCourse(String projectId){
		return dao.findProjectContentCourse(projectId);
	}

	public Page<EduCourse> pageByForEnrollAndUserId(Page<EduCourse> page,EduCourse eduCourse){
		eduCourse.setPage(page);
		page.setList(dao.pageByForEnrollAndUserId(eduCourse));
		return page;
	}
	
	public EduCourse listByForEnrollAndCourseId(String courseId,String userId){
		return dao.listByForEnrollAndCourseId(courseId,userId);
	}
	
	public Page<EduCourse> creditCertificate(Page<EduCourse> page,EduCourse eduCourse){
		eduCourse.setPage(page);
		page.setList(dao.creditCertificate(eduCourse));
		return page;
	}
	
	public List<EduCourse> creditCertificateNotPage(EduCourse course){
		return dao.creditCertificate(course);
	}
	
	public List<EduCourse> listByForEnrollAndUserId(EduCourse eduCourse){
		return dao.pageByForEnrollAndUserId(eduCourse);
	}
	
	public Page<CourseAndProjectDto> findCourseAndProjectList(Page<CourseAndProjectDto> page, CourseAndProjectDto courseAndProjectDto){
		return dao.findAllList(page,courseAndProjectDto);
	}
	
	public Page<EduCourse> findPage(Page<EduCourse> page, EduCourse eduCourse) {
		return super.findPage(page, eduCourse);
	}
	
	@Transactional(readOnly = false)
	public void save(EduCourse eduCourse) {
		super.save(eduCourse);
	}
	
	@Transactional(readOnly = false)
	public void delete(EduCourse eduCourse) {
		super.delete(eduCourse);
	}
	
}